package cn.xyafu.service.impl;

import cn.xyafu.dao.CommentDao;
import cn.xyafu.po.Comment;
import cn.xyafu.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;

@Service
@Transactional
public class CommentServiceImpl implements CommentService {
    @Autowired
    private CommentDao commentDao;
    //按id查询所有评论
    @Override
    public List<Comment> findAllByLid(HashMap<String,Object> map) {
        return commentDao.findAllByLid(map);
    }

    //按lid查询当前相关评论总数

    @Override
    public Integer countCommentByLid(Integer lid) {
        return commentDao.countCommentByLid(lid);
    }

    //添加评论
    @Override
    public Integer addComment(Comment comment) {
        return commentDao.addComment(comment);
    }
}
